import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    toggle: false,
    count: 11,
    list: [1, 2, 3],
  },
  getters: {
    count2: (state) => state.count,
  },
  mutations: {
    setcount(state, payload) {
      state.count = payload;
    },
  },
  actions: {
    setcount2({ commit }, payload) {
      commit("setcount", payload);
    },
  },
  modules: {
    a: {
      state: {
        a: 1,
      },
      mutations: {
        seta(state) {
          state.a = 2;
        },
      },
    },
  },
});
